﻿using System;
using Messages;
using Rhino.ServiceBus;
using Rhino.ServiceBus.Hosting;
using Rhino.ServiceBus.Msmq;
using Utils;

namespace Client_MSMQ
{
    class Program
    {
        static void Main(string[] args)
        {
            PrepareQueues.Prepare("msmq://localhost/client_msmq", QueueType.Standard);

            var host = new DefaultHost();
            host.Start<BootStrapper>();

            var bus = host.Bus as IServiceBus;

            Console.WriteLine("Type something and press enter to send message");
            var msg = Console.ReadLine();

            bus.Send(new Message_Type1
            {
                Content = msg
            });

            Console.ReadLine();
        }
    }

    public class MessageIntercept : ConsumerOf<Message_Type2>
    {
        public void Consume(Message_Type2 msg)
        {
            Console.WriteLine(msg.Text);
        }
    }
}
